﻿using System;

namespace Homework_Snake1015
{
    internal class Food
    {
        Pos[,] pos;
        int width;
        int height;
        static public int foodx;
        static public int foody;
        Random random = new Random();


        public Food(int width, int height)
        {
            this.width = width;
            this.height = height;
            pos = new Pos[width-1, height-1];
        }

        void DrawFood()
        {
            foodx = random.Next(1, width-1);
            foody = random.Next(1, height-1);
            Console.SetCursorPosition(foodx, foody);
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("M");
        }

        public void Init()
        {
            DrawFood();
        }

        public void Input()
        {
            
        }

        public void Update()
        {

        }

        public void Render()
        {
            for (int i = 0; i < Snake.length + 1; i++)
            {
                if (Snake.pos[i].x == foodx && Snake.pos[i].y == foody)
                {
                    DrawFood();
                }
            }
        }
        public void End()
        {

        }
    }
}
